var showHeadingModifyMenu = function(element){
	 	
		var option = initRightMenu(element);
		
		var changeTitle = dojo.create("div",{
			innerHTML: "Change heading title: ",
			style:  "font-size: 13px; color: #aaaaaa;",
		});
		
		var inputTitle = dojo.create("input",{
			id: "inputTitle",
			type: "text",
			value: dijit.byId(element.id).label,
		});
		
		dojo.connect(inputTitle, "onchange", function(){
			
			var labelValue = dojo.byId("inputTitle").value;
			dijit.byId(element.id).set("label", labelValue);
			addAttributeToElementInGUIDescriptor(GUIDescriptor, "label", labelValue, element.id);
		});
		
		changeTitle.appendChild(inputTitle);
		option.appendChild(changeTitle);
 		
 		var connectToView = dojo.create("div", {innerHTML: "Connect to View: ",
 			style:  "font-size: 13px; color: #aaaaaa;",
 		});
 		
 		var selector = dojo.create("select",{id: "sel"+elementsIdCounter});
 		elementsIdCounter++;
 		
 		dojo.connect(selector, "onchange", function(){
 			connectHeadingWithView(element.id, selector.id);
 			addAttributeToElementInGUIDescriptor(GUIDescriptor, "back", "View"+selector.value, element.id);
 			addAttributeToElementInGUIDescriptor(GUIDescriptor, "moveTo", "View"+selector.value, element.id);
 			addAttributeToElementInGUIDescriptor(GUIDescriptor, "transition", "slide", element.id);
 		});
 		
// 		selector.setAttribute("onChange", "connectHeadingWithView('"+element.id+"', '"+selector.id+"')");
 		
 		for(var i=0; i<numberOfPages; i++){
 			var selectorOption = dojo.create("option", {value: i+1, innerHTML: i+1});
 			selector.appendChild(selectorOption);
 		}
 		
 		connectToView.appendChild(selector);
 		option.appendChild(connectToView);
 		
 		
 		dojo.subscribe("/addNewWorkspacePage", function(nP){ var selectorOption = dojo.create("option", {value: nP.newPageNumber, innerHTML: nP.newPageNumber}); selector.appendChild(selectorOption); } );
 	};
	 	
 	var connectHeadingWithView = function(headingId, selectorId){
 		dijit.byId(headingId).set('back','View'+ dojo.byId(selectorId).value);
 		dijit.byId(headingId).set('moveTo','View'+ dojo.byId(selectorId).value);
 		dijit.byId(headingId).set('transition','flip');
 		
 		var selectorValue = dojo.byId(selectorId).value;
 		
 		dijit.byId(headingId).on("click",function(){ dojo.publish("/viewChanged", {destinationView: selectorValue});});
 		//dijit.byId(headingId).on("click",function(){dojo.byId("pageSelector").value = selectorValue; });
 		
 	};